package com.fare.taluo.core.domain.crawl.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.dayatang.hibernate.EntityRepositoryHibernate;
import com.fare.taluo.core.domain.crawl.TaskAssignDayEntity;
import com.fare.taluo.core.domain.crawl.TaskAssignDayEntityRepository;

@Repository
public class TaskAssignDayEntityRepositoryImpl extends
		EntityRepositoryHibernate implements TaskAssignDayEntityRepository {

	@Override
	public TaskAssignDayEntity findTaskAssignDayEntityById(Long id)
			throws Exception {
			return super.get(TaskAssignDayEntity.class, id);
	}

	@Override
	public void deleteTaskAssignDayEntity(TaskAssignDayEntity t)
			throws Exception {
			super.remove(t);
	}

	@Override
	public void saveOrUpdate(TaskAssignDayEntity t) throws Exception {
		super.save(t);
	}

	@Override
	public List<TaskAssignDayEntity> findTaskAssignDayEntityByTempId(Long tempId)
			throws Exception {
		
		StringBuffer sbf=new StringBuffer("from TaskAssignDayEntity a where 1=1 ");
		List<Object> list = new ArrayList<Object>();
		sbf.append(" and a.taskTemplateEntity.id ='"+tempId+"'");
		
		List<TaskAssignDayEntity> lists =super.find(sbf.toString(),list.toArray(),com.fare.taluo.core.domain.crawl.TaskAssignDayEntity.class);
		return lists;
	}

}
